﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TemplateWizard;
using System.Windows.Forms;
using System.IO;
using EnvDTE;

namespace WizardExtension
{
    public class SolutionExtension : IWizard
    {
        public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        {

        }

        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {
            
        }

        public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {
        }

        public void RunFinished()
        {

        }

        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            string name = replacementsDictionary["$safeprojectname$"];

            if (name.Contains("."))
                name = name.Substring(0, name.IndexOf("."));

            if (string.IsNullOrEmpty(name))
                name = "Solution";

            replacementsDictionary["$rootnamespace$"] = name;
        }

        public bool ShouldAddProjectItem(string filePath)
        {
            return true;
        }
    }
}

